<?php
class Post extends Item {

	var $Action;
	var $RealtyType;
	var $SettlementRegion;
	var $SettlementCity;
	var $Street;
	var $Area;
	var $Price;
	var $Description;
	var $PersonName;
	var $eMail;
	var $ICQ;
	var $Phone;
	var $PostDate;
	
	function Post($id){	
		$settings = &getService('GlobalSettings');

		$link = mysql_connect($settings->get('db_host'), $settings->get('db_username'), $settings->get('db_password'));
		mysql_select_db($settings->get('db_name'), $link) or die(mysql_error());
		
		$query = 'select * from realty_data where post_id = ' . $id;
		$res = mysql_query($query) or die(mysql_error());
		
		while ($row=mysql_fetch_array($res)){
			$this->Action = $row['r_type'];
			$this->RealtyType = $row['r_what'];
			$this->SettlementRegion = $row['r_region'];
			$this->SettlementCity = $row['r_city'];
			$this->Street = $row['r_street'];
			$this->Price = $row['r_price'];
			$this->Area = $row['r_area'];
			$this->Description = $row['r_description'];
			$this->PersonName = $row['r_personname'];
			$this->eMail = $row['r_email'];
			$this->ICQ = $row['r_ICQ'];
			$this->Phone = $row['r_phone'];
			$this->PostDate = $row['r_date'];
		}
		mysql_close($link);
	}
}
?>